package 泛型.自定义泛型方法;

public class test {
    public static void main(String[] args) {
        Integer[] a={4,5,87,9};
        shuchu(a);
        String[] b={"傻逼","大","达到年"};
        shuchu(b);
    }
    //能接收所有数据类型
    public static <T> void shuchu(T[] s){
        StringBuilder n=new StringBuilder();
        if(s!=null){
            n.append("{");
            for (int i = 0; i < s.length; i++) {
                n.append(s[i]).append(i==s.length-1?"}":", ");
            }
            System.out.println(n);
        }else{
            System.out.println(s);
        }
    }
}
